home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4027 < prev    next >
Encoding:
Text File  |  1996-08-06  |  3.2 KB  |  74 lines

  1. Newsgroups: comp.lang.c++
  2. Path: netcom.com!marnold
  3. From: marnold@netcom.com (Matt Arnold)
  4. Subject: Re: Help: What is WINSTUB.EXE
  5. Message-ID: <marnoldDLtzz1.Hvz@netcom.com>
  6. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  7. References: <310945D2.2BAC@eurobretagne.fr>
  8. Date: Sat, 27 Jan 1996 08:37:49 GMT
  9. Sender: marnold@netcom20.netcom.com
  10.  
  11. Joδl Connault <conn1002@eurobretagne.fr> writes:
  12.  
  13. >Hi everybody
  14.  
  15. >I'm using Borland c++ 4.0 witn Win 95.
  16. >When compiling some of my previous projets,
  17. >I get this error: Unable to open "WINSTUB.EXE"
  18.  
  19. >What does it mean?
  20.  
  21. First, a bit of history.  All 16-bit Windows programs are two 
  22. programs in one!  At the beginning of a Windows .EXE is a regular 
  23. DOS program.  Following the DOS program is the Windows program.  
  24. When the Windows loader loads a program, it ignores the DOS program 
  25. portion---or "stub".  Likewise, the DOS loader doesn't care about 
  26. the extra "junk" (the Windows portion) at the end of the file and
  27. simply runs the stub as a regular DOS program (it *is* a regular
  28. DOS program).  Everything works out neatly.
  29.  
  30. What does the embedded stub do?  Well, ever wonder where the message 
  31. "This program requires Microsoft Windows" comes from when you try 
  32. to run a Windows program from the DOS prompt?  Well, most Windows 
  33. programs have their little DOS program stub do this.  Windows 
  34. itself does not display that message as many people assume.  In fact, 
  35. the stub doesn't have to print that message at all....you can use
  36. any DOS program for your stub.  That's how the Windows SETUP.EXE
  37. program works.  When you run it from Windows, you get the graphical 
  38. Windows Setup window---obviously a Windows program.  When you run it 
  39. from DOS, you get the "white-on-blue" character-mode DOS version of 
  40. Windows Setup.  Swell, eh?
  41.  
  42. Anyway, most modern compilers automatically insert the little DOS
  43. program that prints that standard message for you.  However, older
  44. Borland tools required that you manually specify the stub program 
  45. in the module definition file (.DEF) using the "STUB" keyword.  The
  46. Borland tools came with the little program called WINSTUB.EXE, 
  47. usually found in the BIN folder, that you were supposed to specify
  48. for the stub.  If you run WINSTUB.EXE directly, you see...
  49.  
  50.    "This program requires Microsoft Windows."
  51.  
  52. ...which you could have guessed if you've been following me so far.
  53.  
  54.  
  55. So...
  56.  
  57. I suspect that one of the .DEF files in your old projects has a STUB 
  58. entry that refers to WINSTUB.EXE and that you don't have a WINSTUB.EXE 
  59. anywhere on your hard disk.  Thus, the error message you got, "Cannot 
  60. open WINSTUB.EXE".
  61.  
  62. With Borland C++ 4.0, the STUB entry is no longer necessary.  If you
  63. simply remove it, I bet your problem will go away.  Better yet, you 
  64. probably don't even need the .DEF file.
  65.  
  66. Regards,
  67. -------------------------------------------------------------------------
  68. Matt Arnold                       |        | ||| | |||| |  | | || ||
  69. marnold@netcom.com                |        | ||| | |||| |  | | || ||
  70. Boston, MA                        |      0 | ||| | |||| |  | | || ||
  71. 617.389.7384 (h) 617.576.2760 (w) |        | ||| | |||| |  | | || ||
  72. C++, MIDI, Win32/95 developer     |        | ||| 4 3 1   0 8 3 || ||
  73. -------------------------------------------------------------------------
  74.